package chapter01;

import java.util.Scanner;

public class Test11_TernaryOperator {
    public static void main(String[] args) {
        //判断条件?表达式1:表达式2
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入第一个数：");
        int a = scanner.nextInt();
        System.out.println("输入第二个数：");
        int b = scanner.nextInt();
        //三元运算符
        int max = a>b?a:b;
        System.out.println("两者之间的最大值："+max);
        //三元运算符的嵌套
        System.out.println("输入第三个数字：");
        int c = scanner.nextInt();
        max = a>b?a>c?a:c:b>c?b:c;
        System.out.println("三者之间的最大值为："+max);
    }
}
